from spider_dangdang import spider as dangdang
from spider_jdbook import  spider as jd



def compareTool(sn):
    """ 比较价格工具 """
    goods_list = []

    #当当数据
    dangdang(sn,goods_list)
    print('当当爬取完成')

    #京东数据
    jd(sn,goods_list)
    print('京东爬取完成')



    #排序
    goods_list = sorted(goods_list,key=lambda item : float(item['price'].replace('¥','')) , reverse=True)
    for i in goods_list:
        print(i)
if __name__ == '__main__':
    sn = input("请输入商品的ISBN码：")
    compareTool(sn)